<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>ResizeObserver</title>
    <style>
        .content {
            border:1px solid;
            width: 300px;
            text-overflow: -o-ellipsis-lastline;
            overflow: hidden;
            text-overflow: ellipsis;
            display: -webkit-box;
            -webkit-line-clamp: 2;
            line-clamp: 2;					
            -webkit-box-orient: vertical;
        }
    </style>
</head>
<body>
    <div class="content">
        你好啊哈哈哈你好啊哈哈<span style="line-height: 3">uuu</span>哈你好啊哈哈哈你好啊哈哈哈你好啊哈哈哈你好啊哈哈哈你好啊哈哈哈你好啊哈哈哈
    </div>
</body>
<!-- npm i intersection-observer -->
<script src="https://polyfill.io/v3/polyfill.min.js?features=ResizeObserver"></script>
<script>
    var content = document.querySelector('.content')
    var observer = new ResizeObserver(function (entries) {
        const p = entries[0]
        console.log(p)
    })
    observer.observe(content)
</script>
</html>